app.controller('EditCtrl', ['$scope', '$location', 'RecipeLoader', '$stateParams', function ($scope, $location, RecipeLoader, $stateParams) {
    console.log($stateParams);
    $scope.db=RecipeLoader().then(function(data){
        $scope.data=data;
    });
    console.log($scope.db);
    $scope.save=function(){
        $scope.db.$save(function(){
            $location.path('/view/'+$stateParams.id);
        });
    };
    $scope.remove=function(){
        //delete
        $location.path("/");
    }
}]);